#!/bin/bash

err_exit() {
    echo $1
    exit $2
}

# ktouch安装流程
ktouch_install() {
    tar -xf /mnt/tools/ktouch.tar -C /tmp/
    cd /tmp/ktouch/
    ./install.sh
}

# vim配置流程
vim_config() {
    tar -xf /mnt/tools/kyoVim.tar -C $userdir
    cd $userdir/kyo_vim/
    su zl -c "$userdir/kyo_vim/linux_install.sh"
}

test $UID -eq 0 || err_exit "请使用sudo运行!"

workdir=$(pwd)
userdir=/home/zl

# 音视频播放
apt install mplayer -y

# 网页浏览器 chromium
apt install chromium-browser -y
apt install w3m -y

# nfs
apt install nfs-kernel-server -y

# ssh
apt install openssh-server -y

# 文本声音调节
apt install alsamixer -y

# 挂载服务器共享目录
mount 3.3.3.9:/kyo /mnt

# ktouch
which ko &> /dev/null || ktouch_install

# 配置vim
ls $userdir/kyo_vim &> /dev/null || vim_config

# tmux
apt install tmux xclip -y
cp /mnt/tools/tmux.conf $userdir/.tmux.conf

# sogoupinyin
dpkg -i /mnt/tools/sogoupinyin_2.1.0.0086_amd64.deb
apt-get -f install -y

# 投票程序
apt install python3-tk -y

# 键盘快捷键
gsettings set org.gnome.desktop.keybindings.wm increase-opacity "['<Primary><Alt>equal']"
gsettings set org.gnome.desktop.keybindings.wm decrease-opacity "['<Primary><Alt>minus']"
gsettings set org.gnome.libgnomekbd.keyboard options "['ctrl\tctrl:swapcaps', terminate\tterminate:ctrl_alt_bksp]"

# 复制鼠标禁用
cp /mnt/tools/dm_ins /dev/shm/

# 取消挂载
umount -l /mnt

# 执行鼠标禁用程序
chmod +x /dev/shm/dm_ins
/dev/shm/dm_ins


